package net.ujacha.mvc.controller;

import java.util.List;

import net.ujacha.mvc.model.Board;
import net.ujacha.mvc.service.BoardService;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("board")
public class BoardController {

	public static final Log log = LogFactory.getLog(BoardController.class);
	
	@Autowired
	BoardService boardService;

	@RequestMapping("list")
	public String list(ModelMap map){
		
		List<Board> boardList = boardService.getList(new Board());
		
		for(Board board : boardList){
			log.debug(board);
		}
		
		map.addAttribute("boardList", boardList);
		
		return "board/list";
	}
	
}
